package com.zwl.smartplatform.pojo;


import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

public class Category implements CheckNull {

  private long cId;
  private String categoryName;
  private String txCommand;
  private String rxCommand;
  private String commandName;
  private long status;
  private java.util.Date createTime;
  private String createBy;
  private java.util.Date updateTime;
  private String updateBy;

  @Override
  public boolean isEmpty(CheckType type) {
    switch (type){
      case ADD://添加到时候大部分数据都是可以为空 唯独分类到名字不能为空
        return !StringUtils.hasText(categoryName);
      case UPDATE:
        return(ObjectUtils.isEmpty(cId)||cId<0)||
              (!StringUtils.hasText(categoryName)
               &&!StringUtils.hasText(txCommand)
               &&!StringUtils.hasText(rxCommand)
               &&!StringUtils.hasText(commandName)
               &&(ObjectUtils.isEmpty(status)||status<0));
    }
    return CheckNull.super.isEmpty(type);
  }

  public long getCId() {
    return cId;
  }

  public void setCId(long cId) {
    this.cId = cId;
  }


  public String getCategoryName() {
    return categoryName;
  }

  public void setCategoryName(String categoryName) {
    this.categoryName = categoryName;
  }


  public String getTxCommand() {
    return txCommand;
  }

  public void setTxCommand(String txCommand) {
    this.txCommand = txCommand;
  }


  public String getRxCommand() {
    return rxCommand;
  }

  public void setRxCommand(String rxCommand) {
    this.rxCommand = rxCommand;
  }


  public String getCommandName() {
    return commandName;
  }

  public void setCommandName(String commandName) {
    this.commandName = commandName;
  }


  public long getStatus() {
    return status;
  }

  public void setStatus(long status) {
    this.status = status;
  }


  public java.util.Date getCreateTime() {
    return createTime;
  }

  public void setCreateTime(java.util.Date createTime) {
    this.createTime = createTime;
  }


  public String getCreateBy() {
    return createBy;
  }

  public void setCreateBy(String createBy) {
    this.createBy = createBy;
  }


  public java.util.Date getUpdateTime() {
    return updateTime;
  }

  public void setUpdateTime(java.util.Date updateTime) {
    this.updateTime = updateTime;
  }


  public String getUpdateBy() {
    return updateBy;
  }

  public void setUpdateBy(String updateBy) {
    this.updateBy = updateBy;
  }

}
